package com.zuorenke.vertx;

import com.zuorenke.vertx.config.VertxProperties;
import com.zuorenke.vertx.verticle.RouterRegistryVerticle;
import io.vertx.ext.web.Router;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;

/**
 * 开始注册vertx相关服务
 */
@Slf4j
public class DeployVertxServer {
	private DeployVertxServer(){}
	public static void startDeploy(Router router, VertxProperties properties) throws IOException {
		log.info("Start Deploy Router Verticle....");
		VertxUtil.getVertxInstance().deployVerticle(new RouterRegistryVerticle(router, properties.getHttpServerPort()));
//		log.info("Start Deploy async Verticle....");
//		if (properties.getAsyncServiceInstances() < 1) {
//			properties.setAsyncServiceInstances(1);
//		}
//		for (int i = 0; i < properties.getAsyncServiceInstances(); i++) {
//			VertxUtil.getVertxInstance().deployVerticle(new AsyncRegistVerticle(properties.getAsyncServiceImplPackages())
//					, new DeploymentOptions().setWorker(true));
//		}
	}
	
}
